﻿using System;
using UnityEngine;
using UBlockly.Util;
using UBlockly.Compotent;
using UnityEngine.EventSystems;

namespace UBlockly
{
    /// <summary>
    /// 物理节点
    /// </summary>
    public sealed class UBlocklyPhysic : MonoBehaviour
    {
        private System.Action updataDo;
        public ISideBarHandler SideBarHandler;
        [SerializeField]public GameObject RootGo;
        [SerializeField]public Transform NodeRootTransform;

        private void Awake()
        {
            SideBarHandler = RootGo.GetComponentInChildren<ISideBarHandler>();
        }

        public Transform Find(string name)
        {
            return RootGo.transform.Find(name);
        }

        public void SetUpdater(System.Action updater)
        {
            updataDo = updater;
        }

        public void Update()
        {
            if (updataDo != null)
                updataDo();
        }
    }
}
